package com.link.base.base.accnt.controller;
/**
 * @author: 郑洪达
 * @date: 2018-11-27
 * @comments:
 */

import com.link.base.base.accnt.model.AccountDetail;
import com.link.base.base.accnt.service.AccountDetailService;
import com.link.core.cllog.LCLogger;
import com.link.core.basic.annotations.JsonParam;
import com.link.core.basic.controller.BasicController;
import com.link.core.basic.service.BasicService;
import com.link.core.basic.service.KeyGenerateService;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/link/accountDetail")
public class AccountDetailController extends BasicController<AccountDetail> {

    @Resource
    private KeyGenerateService keyGenerateService;

    @Resource
    private AccountDetailService accountDetailService;

    @Override
    public BasicService<AccountDetail> getBasicService() throws Exception {
        return accountDetailService;
    }


    /**
     * 更新企业认证图片
     */
    @RequestMapping("/updateCertificateImg")
    @ResponseBody
    public Map<String, Object> updateCertificateImg(@JsonParam AccountDetail entity) {
        Map<String, Object> result = new HashMap<String, Object>(4);
        try {
            accountDetailService.updateCertificateImg(entity);
            AccountDetail newRow = accountDetailService.queryById(entity);
            result.put("success", true);
            result.put("newRow", newRow);
        } catch (Exception e) {
            LCLogger.withException(e);
            result.put("success", false);
            result.put("result", e.getMessage());
        }
        return result;
    }
}
